<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>小鱼ADMIN</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/public/static/css/font.css">
    <link rel="stylesheet" href="/public/static/css/bgadmin.css">
    <script type="text/javascript" src="/public/static/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/public/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/public/static/js/bgadmin.js"></script>
  </head>
  <style>
  .layui-input{height:30px;}
  .layui-form-label{line-height: 16px;}
  </style>
  <body>
    <div class="bg-body">
	  <div class="layui-row">
        <div class="layui-form-item">
			{if condition="($username eq 'admin') OR ($priv['add'] eq 'Y')"}
			<div class="layui-inline">
			<button class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;" onclick="bg_admin_show('添加用户','./addUsers.html',500,500)"><i class="iconfont1">&#xe695; </i>添加</button>
			</div>
			<div class="layui-inline">
			<button class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;" onclick="bg_admin_show('批量添加用户','./batchAddUsers.html',700,400)"><i class="iconfont1">&#xe68f; </i>批量添加</button>
			</div>
			{/if}
			{if condition="($username eq 'admin') OR ($priv['edit'] eq 'Y')"}
			<div class="layui-inline">
			<button class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;" onclick="batchChangeDepartment()"><i class="iconfont1">&#xe6c9; </i>批量换部门</button>
			</div>
			<div class="layui-inline">
			<button class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;" id="clearPassword"><i class="iconfont1">&#xe6d8; </i>清空密码</button>
			</div>
			{/if}
			{if condition="($username eq 'admin') OR ($priv['delete'] eq 'Y')"}
			<div class="layui-inline">
			<button class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;" id="deleteUsrs"><i class="iconfont1">&#xe651; </i>删除用户</button>
			</div>
			{/if}
			{if condition="($username eq 'admin') OR ($priv['setting_ip'] eq 'Y')"}
			<div class="layui-inline">
			<button class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;" onclick="settingIp()"><i class="iconfont1">&#xe63e; </i>批量设置登录IP</button>
			</div>
			{/if}
		</div>
	  </div>
      <div class="layui-row">
        <form class="layui-form ">
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">姓名：</label>
              <div class="layui-input-inline">
                <input type="text" name="cn_name" id= "cn_name_id" lay-verify="" autocomplete="off" class="layui-input">
              </div>
            </div>
			
			<div class="layui-inline">
			  <label class="layui-form-label">所属部门：</label>
			  <div class="layui-input-inline">
				<select name="dept_id" id="dept_id" lay-search="" autocomplete="off" class="layui-input">
					<option value="">直接选择或搜索选择</option>
					<option value="0">顶级部门</option>
					{$options}
				</select>
			  </div>
			</div>
			
			<div class="layui-inline">
              <label class="layui-form-label">角色：</label>
              <div class="layui-input-inline">
                <select name="r_id" id="r_id" lay-search="">
                  <option value="">直接选择或搜索选择</option>
                  {volist name="roleList" id="vo"}
                  <option value="{$vo.r_id}">{$vo.r_name}</option>
                  {/volist}
                </select>
              </div>
            </div>
			
             <a class="layui-btn layui-btn-small"  style="margin-bottom: 10px;" id="search"  lay-submit="" lay-filter="sreach"><i class="layui-icon" >&#xe615;</i></a>
              
          </div>
        </form>
      </div>

      <table class="layui-table" lay-data="{id: 'idUser', height:400, url:'/index.php/crm/Users/userDataList', page:true,limit:10,}" lay-filter="demo">
        <thead>
        <tr>
          <th lay-data="{checkbox:true, fixed: true}"></th>
          <th lay-data="{field:'username', align:'center', width:120, sort: true}">工号</th>
          <th lay-data="{field:'cn_name', width:120}">姓名</th>
          <th lay-data="{field:'r_name', width:120}">角色</th>
          <th lay-data="{field:'department', width:120}">部门</th>
          <th lay-data="{field:'IP_range', align:'center', width:160}">登录IP范围</th>
          <th lay-data="{fixed: 'right', width:100, align:'center', toolbar: '#barDemo'}">操作</th>
        </tr>
        </thead>
      </table>
       
      <script type="text/html" id="barDemo">
		{if condition="($username eq 'admin') OR ($priv['edit'] eq 'Y')"}
        <a class="layui-btn layui-btn-mini" lay-event="edit">编辑</a>
		{/if}
		<!--{if condition="($username eq 'admin') OR ($priv['enable'] eq 'Y')"}
		<a class="layui-btn layui-btn-primary layui-btn-mini" lay-event="detail">清除密码</a>
		{/if}
		{if condition="($username eq 'admin') OR ($priv['delete'] eq 'Y')"}
        <a class="layui-btn layui-btn-danger layui-btn-mini" lay-event="del">删除</a>
		{/if}-->
      </script>
    </div>
    <script type="text/javascript" src="/public/static/crm/js/users/usersList.js"></script>
  </body>
  <div class="bg-body" id="id_setting" style="display:none;">
        <form class="layui-form" action="#" method="post">
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label"><span class="bg-red">*&nbsp;&nbsp;</span>部门：</label>
              <div class="layui-input-inline">
                <select id='update_department_id'>
                  <option value="">请选择</option>
                  <option value="0">顶级部门</option>
                    {$options}
                </select>
              </div>
            </div>
          </div>
          <input type="hidden" id="username_id"/>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <a  class="layui-btn" onclick="updateDepartment();">
                  提交
              </a>
          </div>
      </form>
    </div>
	<div class="bg-body" id="ip_setting" style="display:none;">
        <form class="layui-form" action="#" method="post">
          <div class="layui-form-item">
			<div class="layui-inline">
			  <label class="layui-form-label">IP地址范围</label>
			  <div class="layui-input-inline" >
				<input type="text" id="ip_min_id" placeholder="192.168.1.1" autocomplete="off" class="layui-input">
			  </div>
			  <div class="layui-form-mid">-</div>
			  <div class="layui-input-inline" >
				<input type="text" id="ip_max_id" placeholder="192.168.1.255" autocomplete="off" class="layui-input">
			  </div>
			</div>
		  </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <a  class="layui-btn" onclick="updateIP();">
                  提交
              </a>
          </div>
      </form>
    </div>
</html>